#ifndef HTTPRESPONESE_H
#define HTTPRESPONESE_H
#include <QObject>
#include <QMap>
#include <QByteArray>
#include "connection.h"

/**
 * http响应类
 * @brief The HttpResponse class
 */
class HttpResponse:public QObject
{
    Q_OBJECT

private:
    Connection * conn = nullptr;
    friend class HttpParser;
    int statusCode;//状态码
    QMap<QString, QString> responseHeader; //响应头
public:
    HttpResponse(QObject * parent);
    ~HttpResponse();
    /**
     * 添加响应头
     * @brief addHeader
     * @param name
     * @param value
     */
    void addHeader(QString& name, QString& value);

    /**
     * 响应客户端
     * @brief write
     * @param responseBody
     * @param len
     */
    void write(QByteArray * responseBody, int len);

};

#endif // HTTPRESPONESE_H
